package com.fengye.sphere.service.system.service;

import com.fengye.sphere.api.domain.vo.UserVO;
import com.fengye.sphere.api.feign.UserServiceFeign;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.concurrent.TimeUnit;

/**
 * @author gaohaiqing
 * @since 2023/12/9
 */
@Service
@Slf4j
public class SystemService {

    @Autowired
    UserServiceFeign userServiceFeign;

    public void getUsers() {
        List<UserVO> userVOS = userServiceFeign.userList();
        log.info("userVOS = {}", userVOS);
    }

    @Scheduled(fixedRate = 5, timeUnit = TimeUnit.SECONDS)
    public void getUser() {
        UserVO userVOS = userServiceFeign.user(1L);
        log.info("userVOS = {}", userVOS);
    }

}